package com.example.yls.demoa;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import java.util.ArrayList;

/**
 * Created by yls on 2019/4/19.
 */

public class MypageViewAdapter extends FragmentPagerAdapter{
    private ArrayList<Fragment> fragments;

    public MypageViewAdapter(FragmentManager fm,ArrayList<Fragment> fragments) {
        super(fm);
        this.fragments=fragments;
    }

    @Override
    public Fragment getItem(int position) {
        return fragments.get(position);
    }

    @Override
    public int getCount() {
        return fragments.size();
    }

    @Override
    public CharSequence getPageTitle(int position) {

      switch (position){
          case 0:
              return "消息";
          case 1:
              return "通讯录";
          case 2:
              return "发现";
          case 3:
              return "我的";
      }

        return null;
    }
}
